package cn.edu.ecut.se2024.service;

import cn.edu.ecut.se2024.dao.ContractsManagementDAO;
import cn.edu.ecut.se2024.model.contracts_management.Contract;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContractsManagementService {

    private final ContractsManagementDAO contractsManagementDAO;

    @Autowired
    public ContractsManagementService(ContractsManagementDAO contractsManagementDAO) {
        this.contractsManagementDAO = contractsManagementDAO;
    }

    public Contract findContractById(int id) {
        return contractsManagementDAO.findContractById(id);
    }

    public int insertContract(Contract contract) {
        return contractsManagementDAO.insertContract(contract);
    }

    public int updateContract(Contract contract) {
        return contractsManagementDAO.updateContract(contract);
    }

    public int deleteContract(int id) {
        return contractsManagementDAO.deleteContract(id);
    }

    public List<Contract> getAllContracts() {
        return contractsManagementDAO.getAllContracts();
    }
}